function analysiseGbRst(gbRst, params, tableId, bErrorBox, bSuccessBox) {
	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	if (rst.result.data != null) {
		$.each(rst.result.data, function(index, dt) {

			$("table[id='" + tableId + "']").append("<tr></tr>");
			$(phArray).each(
					function(phIndex, data) {
						$.each($(dt), function(dtIndex, d) {
							if (dtIndex == data) {

								$("table[id='" + tableId + "'] tr:last")
										.append("<td>" +  (d === null ? " "
												: d) + "</td>");
							}
						});
					});
		});
	}
}

function analysiseGbRstWithCheckBox(gbRst, params, tableId, url, bErrorBox,
		bSuccessBox) {
	var rst = JSON.parse(gbRst);
	// var rst = gbRst;
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	var ckArray = new Array("id");

	var ckCount = 0;

	$.each(rst.result.head, function(hIndex, hData) {
		if (hData == "id") {
			ckArray[ckCount++] = hIndex;
		}
	});

	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}

	if (rst.result.data != null) {
		$.each(rst.result.data, function(index, dt) {
			$("table[id='" + tableId + "']").append("<tr></tr>");
			var checkData = "";
			$(ckArray).each(function(ckIndex, ckData) {

				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});
			$("table[id='" + tableId + "'] tr:last").append(
					"<td><input type='checkBox' value='" + checkData
							+ "'/></td>");
			$(phArray).each(
					function(phIndex, data) {
						$.each($(dt), function(dtIndex, d) {
							if (dtIndex == data) {

								$("table[id='" + tableId + "'] tr:last")
										.append("<td>" + d + "</td>");
							}
						});
					});
		});
	}
}
// checkbox只能选择一个
function analysiseGbRstWithCheckBoxOneOption(gbRst, params, tableId, url,
		bErrorBox, bSuccessBox) {
	var rst = JSON.parse(gbRst);
	// var rst = gbRst;
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	var ckArray = new Array("id");

	var ckCount = 0;

	$.each(rst.result.head, function(hIndex, hData) {
		if (hData == "id") {
			ckArray[ckCount++] = hIndex;
		}
	});

	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}

	if (rst.result.data != null) {
		$.each(rst.result.data, function(index, dt) {
			$("table[id='" + tableId + "']").append("<tr></tr>");
			var checkData = "";
			$(ckArray).each(function(ckIndex, ckData) {

				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});
			$("table[id='" + tableId + "'] tr:last").append(
					"<td><input type='checkBox' value='" + checkData
							+ "' onclick='javascript:cancleOthers(this.value,"
							+ tableId + ")'/></td>");
			$(phArray).each(
					function(phIndex, data) {
						$.each($(dt), function(dtIndex, d) {
							if (dtIndex == data) {

								$("table[id='" + tableId + "'] tr:last")
										.append("<td>" + d + "</td>");
							}
						});
					});
		});
	}
}
function analysiseGbRstWithCheckBoxPs(gbRst, params, ckArrayPs, tableId,
		bErrorBox, bSuccessBox) {
	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {

				ckArray[ckCount++] = hIndex;
			}
		});
	});

	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}

	if (rst.result.data != null) {
		$.each(rst.result.data, function(index, dt) {
			$("table[id='" + tableId + "']").append("<tr></tr>");
			var checkData = "";
			$(ckArray).each(function(ckIndex, ckData) {

				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});

			});
			$("table[id='" + tableId + "'] tr:last").append(
					"<td><input type='checkBox' value='" + checkData
							+ "'/></td>");
			$(phArray).each(
					function(phIndex, data) {
						$.each($(dt), function(dtIndex, d) {
							if (dtIndex == data) {

								$("table[id='" + tableId + "'] tr:last")
										.append("<td>" + d + "</td>");
							}
						});
					});
		});
	}
}
// analysiseGbRstWithCheckBoxOneOption:辅助函数
// 该方法是根据checkbox中的value来判断是否被选中
function cancleOthers(value, tableId) {

	var cks = $("table #" + tableId + "input[type='checkbox']");
	if ($("table #" + tableId + "input[type='checkbox'][value=" + value + "]")
			.attr("checked") == true) {
		cks.attr("checked", false);
		$("table #" + tableId + "input[type='checkbox'][value=" + value + "]")
				.attr("checked", true);

	} else {
		$("table #" + tableId + "input[type='checkbox'][value=" + value + "]")
				.attr("checked", false);
	}

}

// 生成列表 根据主报价ID生成对应的报价明细
function listWithClickByID(gbRst, params, tableId, bErrorBox, bSuccessBox) {
	var rst = JSON.parse(gbRst);
	// var rst = gbRst;
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	var ckArray = new Array("id");

	var ckCount = 0;

	$.each(rst.result.head, function(hIndex, hData) {
		if (hData == "id") {
			ckArray[ckCount++] = hIndex;
		}
	});

	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}

	if (rst.result.data != null) {
		$.each(rst.result.data, function(index, dt) {
			$("table[id='" + tableId + "']").append("<tr></tr>");
			var checkData = "";
			$(ckArray).each(function(ckIndex, ckData) {

				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});

			$(phArray).each(
					function(phIndex, data) {
						$.each($(dt), function(dtIndex, d) {
							if (dtIndex == data) {

								$("table[id='" + tableId + "'] tr:last")
										.append("<td>" + d + "</td>");
							}
						});
					});

			$("table[id='" + tableId + "'] tr:last").append(
					"<td><a href=\"javascript:checkQuoteDetail('" + checkData
							+ "')\">查看详情</a></td>");
		});
	}

}

//生成列表 根据主报价ID生成对应的报价明细
function listWithClickByIDRestTime(gbRst, params, timeFiles,tableId, bErrorBox, bSuccessBox) {
	
	//----------------------
	var timeArray = new Array();
	var tAfCount = 0;
	//----------------------
	var rst = JSON.parse(gbRst);
	// var rst = gbRst;
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	var ckArray = new Array("id");

	var ckCount = 0;

	$.each(rst.result.head, function(hIndex, hData) {
		if (hData == "id") {
			ckArray[ckCount++] = hIndex;
		}
	});
	// 时间区域索引
	var timeCount = 0;
	var timeFilesArr = new Array(timeFiles.length);
	$(timeFiles).each(function(index, timeData) {
		$.each(rst.result.head, function(tfIndex, tfData) {
			if (tfData == timeData) {
				timeFilesArr[timeCount++] = tfIndex;
			}
		});
	});
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}

	if (rst.result.data != null) {
		$.each(rst.result.data, function(index, dt) {
			$("table[id='" + tableId + "']").append("<tr></tr>");
			var checkData = "";
			$(ckArray).each(function(ckIndex, ckData) {

				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});

			$(phArray).each(
			function(phIndex, data) {
			$.each($(dt), function(dtIndex, d) {
				if (dtIndex == data) {
					if (isHiddenFile( timeFilesArr, data)) {
						if (d != null) {
							$( "table[id='" + tableId + "'] tr:last").append( 
									"<td width='103' ><div id='quoteRestTime_" + tAfCount + "'>" + d + "</div></td>");
							timeArray[tAfCount++] = d;
						}
					}else{
					$("table[id='" + tableId + "'] tr:last") .append("<td>" + d + "</td>");}
				}
			});
			});

			$("table[id='" + tableId + "'] tr:last").append("<td><a href=\"javascript:checkQuoteDetail('" + checkData + "')\">查看详情</a></td>");
		});
		$("#timeArray").val(timeArray);
		
		getRestTime1();
	}

}

function listWithClickByIDWithoutEdit(gbRst, params, tableId, bErrorBox,
		bSuccessBox) {
	var rst = JSON.parse(gbRst);
	// var rst = gbRst;
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	var ckArray = new Array("id");

	var ckCount = 0;

	$.each(rst.result.head, function(hIndex, hData) {
		if (hData == "id") {
			ckArray[ckCount++] = hIndex;
		}
	});

	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}

	if (rst.result.data != null) {
		$.each(rst.result.data, function(index, dt) {
			$("table[id='" + tableId + "']").append("<tr></tr>");
			var checkData = "";
			$(ckArray).each(function(ckIndex, ckData) {

				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});

			$(phArray).each(
					function(phIndex, data) {
						$.each($(dt), function(dtIndex, d) {
							if (dtIndex == data) {

								$("table[id='" + tableId + "'] tr:last")
										.append("<td>" + d + "</td>");
							}
						});
					});

		});
	}

}
function analysiseGbRstWithCheckBoxAndEdit(gbRst, params, tableId, url,
		bErrorBox, bSuccessBox) {
	var rst = JSON.parse(gbRst);
	// var rst = gbRst;
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	var ckArray = new Array("id");

	var ckCount = 0;

	$.each(rst.result.head, function(hIndex, hData) {
		if (hData == "id") {
			ckArray[ckCount++] = hIndex;
		}
	});

	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}

	if (rst.result.data != null) {
		$.each(rst.result.data, function(index, dt) {
			$("table[id='" + tableId + "']").append("<tr></tr>");
			var checkData = "";
			$(ckArray).each(function(ckIndex, ckData) {

				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});
			$("table[id='" + tableId + "'] tr:last").append(
					"<td><input type='checkBox' value='" + checkData
							+ "'/></td>");
			$(phArray).each(
					function(phIndex, data) {
						$.each($(dt), function(dtIndex, d) {
							if (dtIndex == data) {

								$("table[id='" + tableId + "'] tr:last")
										.append("<td>" + (d === null ? " "
												: d)+ "</td>");
							}
						});
					});

			$("table[id='" + tableId + "'] tr:last").append(
					"<td><a href=\"javascript:edit('" + url + "'," + checkData
							+ ")\">编辑</a></td>");
		});
	}

}
function checkBoxIsSelected(tableCtrlName, confirmMsg, notSelectedMsg,actionUrl,webPagePath) {
	var table = document.getElementById(tableCtrlName);
	if (null == table) {
		return false;
	}
	var data = new Array();
	//获取所有input标签
	var inputItem = table.getElementsByTagName("input");
	//默认为不选择
	var isSelected = false;
	for ( var i = 0; i < inputItem.length; i++) {
		var ctrl = inputItem[i];
		if (ctrl.type == "checkbox" && ctrl.checked) {
			isSelected = true;
			break;
		}
	}
	var count = 0;
	for ( var i = 0; i < inputItem.length; i++) {
		var ctrl = inputItem[i];
		if (ctrl.type == "checkbox" && ctrl.checked) {
			isSelected = true;
			data[count] = ctrl.value;
			count++;
		}
	}
	if (isSelected) {
		if (confirm(confirmMsg)) {
			$.post(actionUrl, {"id":data.toString()}, function() {
				
			/*	$.post(webPagePath,function(data)
						{
								$("#main").html(data);
						});*/
				$("#main",parent.document).attr("src",webPagePath);  
				});
			  
			return true;
		} else {
			return false;
		}
	} else {
		alert(notSelectedMsg);
		return false;
	}
}
function edit(url, id) {
	$.post(url, {
		"id" : id
	}, function(data) {
		$("#main").html(data);
	});
}

function getValueByHeadOneRowGbRst(gbRst, str) {

	if (gbRst != null) {
		var value = "";
		var headIndex = "";
		$.each(gbRst.result.head, function(index, da) {
			if (str == da) {
				headIndex = index;
			}
		});
		$.each(gbRst.result.data, function(dindex, ddata) {

			$.each($(ddata), function(ddindex, dddata) {

				if (ddindex == headIndex) {

					value = dddata;
				}
			});

		});
		if(value!=null){
			value=value.toString();
		}
		return value;
	}
}

function analysiseGbRstWithCheckBoxAndEditPs(gbRst, params, tableId, ckArrayPs,
		url, bErrorBox, bSuccessBox) {
	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	// checkbox包含多个参数

	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {

				ckArray[ckCount++] = hIndex;
			}
		});
	});

	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}

	if (rst.result.data != null) {
		$.each(rst.result.data, function(index, dt) {
			$("table[id='" + tableId + "']").append("<tr></tr>");
			var checkData = "";
			$(ckArray).each(function(ckIndex, ckData) {

				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});
			$("table[id='" + tableId + "'] tr:last").append(
					"<td><input type='checkBox' value='" + checkData
							+ "'/></td>");
			$(phArray).each(
					function(phIndex, data) {
						$.each($(dt), function(dtIndex, d) {
							if (dtIndex == data) {
								$("table[id='" + tableId + "'] tr:last")
										.append("<td>" + d + "</td>");
							}
						});
					});
			$("table[id='" + tableId + "'] tr:last").append(
					"<td><a href='javascript:edit(\"" + url + "=" + checkData
							+ "\")'>编辑</a></td>");
		});
	}
}

// 查看詳情
function analysiseGbRstWithEditPs(gbRst, params, tableId, ckArrayPs, bErrorBox,
		bSuccessBox) {

	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	// checkbox包含多个参数

	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {
				ckArray[ckCount++] = hIndex;
			}
		});
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	if (rst.result.data != null) {
		$
				.each(
						rst.result.data,
						function(index, dt) {
							var checkData = "";
							$("table[id='" + tableId + "']")
									.append("<tr></tr>");

							$(ckArray).each(function(ckIndex, ckData) {
								var m = ckArray.length - 1;
								$.each($(dt), function(ddtIndex, ddl) {
									if (ddtIndex == ckData) {
										if (ckIndex < m) {
											checkData += ddl + ",";
										} else {
											checkData += ddl;
											return false;
										}
									}
								});
							});
							$(phArray)
									.each(
											function(phIndex, data) {
												$
														.each(
																$(dt),
																function(
																		dtIndex,
																		d) {
																	if (dtIndex == data) {
																		$(
																				"table[id='"
																						+ tableId
																						+ "'] tr:last")
																				.append(
																						"<td>"
																								+ (d === null ? "未填写"
																										: (d === 'null' ? "未填写"
																												: d))
																								+ "</td>");
																	}
																});
											});

							$("table[id='" + tableId + "'] tr:last").append(
									"<td><a href='javascript:checkQuoteDetail("
											+ checkData + ")'>查看详情</a></td>");
						});
	}
}

// 报价
function analysiseGbRstWithEditPsTN(gbRst, params, tableId, ckArrayPs, url,
		bErrorBox, bSuccessBox, textName, divId, mainId) {
	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	// checkbox包含多个参数

	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {

				ckArray[ckCount++] = hIndex;
			}
		});
	});

	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	if (rst.result.data != null) {
		$.each(rst.result.data, function(index, dt) {
			$("table[id='" + tableId + "']").append("<tr></tr>");
			var checkData = "";
			$(ckArray).each(function(ckIndex, ckData) {
				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});
			checkData = "\"" + checkData + "\"";
			$(phArray).each(
					function(phIndex, data) {
						$.each($(dt), function(dtIndex, d) {
							if (dtIndex == data) {
								$("table[id='" + tableId + "'] tr:last")
										.append("<td>" + d + "</td>");
							}
						});
					});
			$("table[id='" + tableId + "'] tr:last")
					.append(
							"<td><input type='button' onclick='javascript:queryData("
									+ checkData + "," + mainId + ")' value='"
									+ (textName == null ? "编辑" : textName)
									+ "'/></td>");
		});

	}
}

function analysiseGbRstPs(gbRst, params, tableId, ckArrayPs, url, bErrorBox,
		bSuccessBox, textName, divId, mainId) {
	var rst = JSON.parse(gbRst);
	var msg = null;
	var checkDataArray = new Array();
	var cdaCount = 0;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	// checkbox包含多个参数

	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {

				ckArray[ckCount++] = hIndex;
			}
		});
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	if (rst.result.data != null) {
		$
				.each(
						rst.result.data,
						function(index, dt) {
							// if (index <= rst.result.data.length) {
							$("table[id='" + tableId + "']")
									.append("<tr></tr>");
							// }
							var checkData = "";
							$(ckArray).each(function(ckIndex, ckData) {
								var m = ckArray.length - 1;
								$.each($(dt), function(ddtIndex, ddl) {
									if (ddtIndex == ckData) {
										if (ckIndex < m) {
											checkData += ddl + ",";
										} else {
											checkData += ddl;
											return false;
										}

									}
								});
							});
							checkDataArray[cdaCount++] = checkData;
							$(phArray)
									.each(
											function(phIndex, data) {
												$
														.each(
																$(dt),
																function(
																		dtIndex,
																		d) {
																	if (dtIndex == data) {
																		$(
																				"table[id='"
																						+ tableId
																						+ "'] tr:last")
																				.append(
																						"<td>"
																								+ (d === null ? "未填写"
																										: (d === 'null' ? "未填写"
																												: d))
																								+ "</td>");
																	}
																});
											});
						});

	}
	// 定义一个变量区分
	return JSON.stringify(checkDataArray);
}

//未提交的报价单列表显示
function analysiseGbRstPsInput(gbRst, params, tableId, ckArrayPs, hiddenFiles,partsCodeFiled,
		statusFile,imageFile, ptparams, quoteDatas,quoteStatus, bErrorBox, bSuccessBox, textName) {
	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	// hiddenFilesArr用来存放隐藏域的索引
	var hfCount = 0;
	var hiddenFilesArr = new Array(hiddenFiles.length);
	$(hiddenFiles).each(function(index, hfData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == hfData) {
				hiddenFilesArr[hfCount++] = hIndex;
			}
		});
	});
	//新增明细图片域
	var imgCount = 0;
	var imgFilesArr = new Array(imageFile.length);
	$(imageFile).each(function(index, ffData) {
		$.each(rst.result.head, function(imgIndex, fffData) {
			if (fffData == ffData) {
				imgFilesArr[imgCount++] = imgIndex;
			}
		});
	});
	// ptTypeId
	var ptTypeCount = 0;
	var ptTypeIdFilesArr = new Array(ptparams.length);
	$(ptparams).each(function(index, ptData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ptData) {
				ptTypeIdFilesArr[ptTypeCount++] = hIndex;
			}
		});
	});
	// checkbox包含多个参数
	var ckArray = new Array();// 用来存储checkbox中多个参数的索引
	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {
				ckArray[ckCount++] = hIndex;
			}
		});
	});
	// 报价状态
	var statusCount = 0;
	var statusFileArr = new Array(statusFile.length);
	$(statusFile).each(function(index, sData) {
		$.each(rst.result.head, function(rfIndex, rfData) {
			if (rfData == sData) {
				statusFileArr[statusCount++] = rfIndex;
			}
		});
	});
	// 报价状态
	var mustInputCount = 0;
	var mIFileArr = new Array(partsCodeFiled.length);
	$(partsCodeFiled).each(function(index, sData) {
		$.each(rst.result.head, function(rfIndex, rfData) {
			if (rfData == sData) {
		
				mIFileArr[mustInputCount++] = rfIndex;
			}
		});
		//alert(mIFileArr[0]);
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var phArray = new Array();
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData.toLowerCase() == hData.toLowerCase()) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	//处理报价情况
	var qdArray = new Array();
	var qdCount = 0;
	if (quoteDatas != null) {
		$(quoteDatas).each(function(qdIndex, qdData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (qdData.toLowerCase() == hData.toLowerCase()) {
					qdArray[qdCount++] = hIndex;
				}
			});
		});
	}
	//单独处理报价状态
	var quoteStatusArray  = new Array();
	var quoteStausCount = 0;
	if(quoteStatus!=null){
		//将quoteStaus转换成一个数组
			$.each(rst.result.head, function(hIndex, hData) {
				if (quoteStatus[0].toLowerCase() == hData.toLowerCase()) {
					quoteStatusArray[0] = hIndex;
				}
			});
	}
	if (rst.result.data != null) {
		$
				.each(
						rst.result.data,
						function(index, dt) {
							$("table[id='" + tableId + "']")
									.append("<tr></tr>");
							//var checkDataArray = new Array();
							//var cdaCount = 0;
							var checkData = "";
							var quoteDatasArray = new Array(12);
							var qdaCount = 0;
							var quoteStatusDatasArray = new Array(5);
							var qstdaCount = 0;
							$(ckArray).each(function(ckIndex, ckData) {
								var m = ckArray.length - 1;
								$.each($(dt), function(ddtIndex, ddl) {
									if (ddtIndex == ckData) {
										if (ckIndex < m) {
											checkData += ddl + ",";
										} else {
											checkData += ddl;
											return false;
										}

									}
								});
							});
							//可用数组的push方法替代
							//checkDataArray[cdaCount++] = checkData;
							$("table[id='"+ tableId+ "'] tr:last").append("<td></td>");
							var cdArr = checkData.split(",");
							var detailStatus=0; 
							$(phArray)
									.each(
											function(phIndex, data) {
												$
														.each(
																$(dt),
																function(
																		dtIndex,
																		d) {
																	if (dtIndex == data) {
																		// <隐藏域>
																		if (isHiddenFile(
																				hiddenFilesArr,
																				data)) {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td style='display:none'><div id='quoteOption_"
																									+ data
																									+ "_"
																									+ d
																									+ "'><input value='"
																									+ (d === null ? " "
																											: (d === 'null' ? " "
																													: d))
																									+ "' style='width:55'></div></td>");
																		
																			// <报价信息数据>
																		} else if (isHiddenFile(
																				qdArray,
																				data)) {
																			quoteDatasArray[qdaCount++] = d;
																		} 
																		else if (isHiddenFile(
																				quoteStatusArray,
																				data)) {
																			quoteStatusDatasArray[0] =d.substr(0,1) ;
																			quoteStatusDatasArray[1] =d.substr(1,1) ;
																			quoteStatusDatasArray[2] =d.substr(2,1) ;
																			quoteStatusDatasArray[3] =d.substr(3,1) ;
																			quoteStatusDatasArray[4] =d.substr(4,1) ;
																		} 
																		else if (isHiddenFile(
																				mIFileArr,
																				data)) {
																			if(data==4){
																			$("table[id='"+ tableId+ "'] tr:last")
																			.append("<td><div id='quoteOption_"+ data+ "_"+ d+ "'><input type='text' id='partsCode_"+cdArr[0]+"' class='notEmpty' value='"
																														  + (d ==null ?"&nbsp":(d ==='null' ?"&nbsp": d))+ "'/></div></td>");}
																			 else if(data==17){
																			 $("table[id='"+ tableId+ "'] tr:last")
																			.append("<td><div id='quoteOption_"+ data+ "_"+ d+ "'><input type='text' id='partsCode_"+cdArr[0]+"' class='empty' value='"
																														  + (d ==null ?"&nbsp":(d === 'null' ?"&nbsp": d))+ "'/></div></td>");}
																			// <状态域>
																		} 
																		else if (isHiddenFile(imgFilesArr,data)) {
																			if (d == null || d=="" || d==undefined || d=='') {
																				$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>无</td>");
																			} else {
																				$("table[id='"+ tableId+ "'] tr:last").append(
																								"<td width='103'><a  href='"+ d+ "' target='blank'>查看</a></td>");
																			}
																		}
																		else if (isHiddenFile(
																				statusFileArr,
																				data)) {
																			detailStatus = d;
																			switch (d) {
																			case 0:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																								.append("<td style='display:none'><div id='quoteOption_"+ data+ "_"+ d+"'><input  id='startQuoteStatus_"+cdArr[0]+"' style='width:55;text-align:center' value='保存' readonly='readonly'></input><span style='display:none' id='startQuoteStatusId_"+cdArr[0]+"'>0</span></div></td>");
																			break;
																			case 1:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																								.append("<td style='display:none'><div id='quoteOption_"+ data+ "_"+ d+"'><input  id='startQuoteStatus_"+cdArr[0]+"' style='width:55;text-align:center' value='发布' readonly='readonly'></input><span style='display:none' id='startQuoteStatusId_"+cdArr[0]+"'>1</span></div></td>");
																			break;
																			case 5:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																					
																	
																								.append("<td style='display:none'><div id='quoteOption_"+ data+ "_"+ d+"'><input  id='startQuoteStatus_"+cdArr[0]+"' style='width:55;text-align:center' value='取消' readonly='readonly'></input><span style='display:none' id='startQuoteStatusId_"+cdArr[0]+"'>5</span></div></td>");
																				break;
																			case 8:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																								.append("<td style='display:none'><div id='quoteOption_"+ data+ "_"+ d+"'><input  id='startQuoteStatus_"+cdArr[0]+"' style='width:55;text-align:center' value='确定报价' readonly='readonly'></input><span style='display:none' id='startQuoteStatusId_"+cdArr[0]+"'>8</span></div></td>");
																			break;
																			default:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																								.append("<div id='quoteOption_"+ data+ "_"+ d+"'><input  id='startQuoteStatus_"+cdArr[0]+"' style='width:55;text-align:center' value='取消' readonly='readonly'></input><span style='display:none' id='startQuoteStatusId_"+cdArr[0]+"'>0</span></div></td>");
																			break;

																			}

																		}
																		// <厂商类别>
																		else if (isHiddenFile(
																				ptTypeIdFilesArr,
																				data)) {
																			switch (d) {
																			
																			case 1:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																						.append(
																								"<td><div id='quoteOption_"
																										+ data
																										+ "_"
																										+ d
																										+ "'><span style='display:none' id='ptFactTpId_"+cdArr[0]+"'>"
																										+ d
																										+ "</span>原厂</div></td>");
																				break;
																			case 2:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																						.append(
																								"<td><div id='quoteOption_"
																										+ data
																										+ "_"
																										+ d
																										+ "'><span style='display:none' id='ptFactTpId_"+cdArr[0]+"'>"
																										+ d
																										+ "</span>配套厂</div></td>");
																				break;
																			case 3:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																						.append(
																								"<td><div id='quoteOption_"
																										+ data
																										+ "_"
																										+ d
																										+ "'><span style='display:none' id='ptFactTpId_"+cdArr[0]+"'>"
																										+ d
																										+ "</span>其他厂</div></td>");
																				break;
																				
																			case 4:
																				$("table[id='"+ tableId	+ "'] tr:last")
																				.append("<td><div id='quoteOption_"	+ data+ "_"+ d+ "'><span style='display:none' id='ptFactTpId_"+cdArr[0]+"'>"+ d+"</span>全部</div></td>");
																			break;

																			}

																		}// <普通域>
																		else {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td><div id='quoteOption_"
																									+ data
																									+ "_"
																									+ d
																									+ "'><input type='text' class='white' disabled='disabled'  value='"
																									+ (d === null ? " "
																											: (d === 'null' ? " "
																													: d))
																									+ "'/></div></td>");

																		}
																	}
																});

											});
							if (cdArr[1]== 1) {
								$("table[id='" + tableId + "'] tr:last")	
								.append(
										"<td><span id='num_"+cdArr[0]+"' style='display:none'>4</span><div><ul style='list-style-type:none'>"+
										"<li>原厂</li>"+
										"<li style='display:none'>高品质(配)</li>"+
										"<li style='display:none'>高性价比(配)</li>"+
										"<li style='display:none'>高品质(其他)</li>"+
										"<li style='display:none'>高性价比(其他)</li>"+
										"</ul></div></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li><input type='text'   value=''  style='width:55' class='notEmpty_quote' id='quoteCO_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly' style='width:55' id='quoteHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly' style='width:55' id='quoteHCE_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly' style='width:55' id='quoteOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly' style='width:55' id='quoteOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li>&nbsp;</li>"+
										"<li style='display:none'><input type='text'   value='' readonly='readonly' disabled='disabled' style='width:55' id='BrandHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='' readonly='readonly' disabled='disabled' style='width:55' id='BrandHCE_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='' readonly='readonly' disabled='disabled' style='width:55' id='BrandOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='' readonly='readonly' disabled='disabled' style='width:55' id='BrandOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li>&nbsp;</li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly' style='width:55'  id='WarrantyHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly'  style='width:55' id='WarrantyHCE_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly' style='width:55'  id='WarrantyOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly'  style='width:55' id='WarrantyOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
									"<td style='display:none'><div><ul style='list-style-type:none'>"+
									"<li style='display:none'><input id='quoteCOStatus_"+cdArr[0]+"' type='text'   value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHQStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHCEStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHQStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHCEStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"</ul></td>")
								.append(
												"<td><div><ul style='list-style-type:none'>"+
												"<li><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteCO\")' id='quoteCO_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button'  value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHQ\")' id='quoteHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHCE\")' id='quoteHCE_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHQ\")' id='quoteOtherHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHCE\")' id='quoteOtherHCE_" + cdArr[0]+"_Btn'/></li>"+
												"</ul></td>");
							
							
							
							}//配件类型非原厂
							else if(cdArr[1]== 2) {
								$("table[id='" + tableId + "'] tr:last")
								.append(
										"<td><span id='num_"+cdArr[0]+"' style='display:none'>3</span><div><ul style='list-style-type:none'>"+
										"<li style='display:none'>原厂</li>"+
										"<li >高品质(配)</li>"+
										"<li >高性价比(配)</li>"+
										"<li style='display:none'>高品质(其他)</li>"+
										"<li style='display:none'>高性价比(其他)</li>"+
										"</ul></div></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='quoteCO_"+cdArr[0]+"' readonly='readonly'/></li>"+
										"<li><input type='text' class='notEmpty_quote'  value=''  style='width:55' id='quoteHQ_"+cdArr[0]+"' /></li>"+
										"<li><input type='text' class='notEmpty_quote'  value=''  style='width:55' id='quoteHCE_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' style='width:55' id='quoteOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' style='width:55' id='quoteOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li style='display:none'><input type='text'   value=''  style='width:55' disabled='disabled'/></li>"+
										"<li><input type='text' class='notEmpty'  value=''  style='width:55' id='BrandHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' class='notEmpty'  value=''  style='width:55' id='BrandHCE_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='' readonly='readonly' disabled='disabled' style='width:55' id='BrandOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='' readonly='readonly' disabled='disabled' style='width:55' id='BrandOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' disabled='disabled'/></li>"+
										"<li><input type='text'   value='' class='empty_warr' style='width:55' id='WarrantyHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='empty_warr' style='width:55' id='WarrantyHCE_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55'  id='WarrantyOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='WarrantyOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
										.append(
									"<td style='display:none'><div><ul style='list-style-type:none'>"+
									"<li style='display:none'><input id='quoteCOStatus_"+cdArr[0]+"' type='text'   value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHQStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHCEStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHQStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHCEStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"</ul></td>")
										.append(
												"<td><div><ul style='list-style-type:none'>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteCO\")' id='quoteCO_" + cdArr[0]+"_Btn'/></li>"+
												"<li ><input type='button'  value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHQ\")' id='quoteHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li ><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHCE\")' id='quoteHCE_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHQ\")' id='quoteOtherHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHCE\")' id='quoteOtherHCE_" + cdArr[0]+"_Btn'/></li>"+
												"</ul></td>");
							}else if(cdArr[1]== 3){
								$("table[id='" + tableId + "'] tr:last")
								.append(
										"<td><span id='num_"+cdArr[0]+"' style='display:none'>3</span><div><ul style='list-style-type:none'>"+
										"<li style='display:none'>原厂</li>"+
										"<li style='display:none'>高品质(配)</li>"+
										"<li style='display:none'>高性价比(配)</li>"+
										"<li >高品质(其他)</li>"+
										"<li >高性价比(其他)</li>"+
										"</ul></div></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='quoteCO_"+cdArr[0]+"' readonly='readonly'/></li>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='quoteHQ_"+cdArr[0]+"' /></li>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='quoteHCE_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' value='' class='notEmpty_quote' style='width:55' id='quoteOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' value='' class='notEmpty_quote' style='width:55' id='quoteOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li style='display:none'><input type='text'   value=''  style='width:55' disabled='disabled'/></li>"+
										"<li style='display:none'><input type='text'   value=''  style='width:55' id='BrandHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value=''  style='width:55' id='BrandHCE_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='notEmpty' style='width:55' id='BrandOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='notEmpty' style='width:55' id='BrandOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' disabled='disabled'/></li>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='WarrantyHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='WarrantyHCE_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' class='empty_warr'  value='' style='width:55'  id='WarrantyOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' class='empty_warr' value='' style='width:55' id='WarrantyOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
										.append(
									"<td style='display:none'><div><ul style='list-style-type:none'>"+
									"<li style='display:none'><input id='quoteCOStatus_"+cdArr[0]+"' type='text'   value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHQStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHCEStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHQStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHCEStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"</ul></td>")
										.append(
												"<td><div><ul style='list-style-type:none'>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteCO\")' id='quoteCO_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button'  value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHQ\")' id='quoteHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHCE\")' id='quoteHCE_" + cdArr[0]+"_Btn'/></li>"+
												"<li ><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHQ\")' id='quoteOtherHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li ><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHCE\")' id='quoteOtherHCE_" + cdArr[0]+"_Btn'/></li>"+
												"</ul></td>");
							}
							else if(cdArr[1]== 4){
								$("table[id='" + tableId + "'] tr:last")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li>原厂</li>"+
										"<li>高品质(配)</li>"+
										"<li>高性价比(配)</li>"+
										"<li>高品质(其他)</li>"+
										"<li>高性价比(其他)</li>"+
										"</u></div></td>")
								.append(
										"<td><span id='num_"+cdArr[0]+"' style='display:none'>0</span><div><ul style='list-style-type:none'>"+
										"<li ><input type='text'   value='' class='notEmpty_quote'  style='width:55' id='quoteCO_"+cdArr[0]+"'/></li>"+
										"<li ><input type='text'   value='' class='notEmpty_quote' style='width:55' id='quoteHQ_"+cdArr[0]+"' /></li>"+
										"<li ><input type='text'   value='' class='notEmpty_quote' style='width:55' id='quoteHCE_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' value='' class='notEmpty_quote' style='width:55' id='quoteOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' value='' class='notEmpty_quote' style='width:55' id='quoteOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li>&nbsp;</li>"+
										"<li><input type='text'   value='' class='notEmpty' style='width:55' id='BrandHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='notEmpty' style='width:55' id='BrandHCE_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='notEmpty' style='width:55' id='BrandOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='notEmpty' style='width:55' id='BrandOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li  >&nbsp;</li>"+
										"<li ><input type='text'   value=''  class='empty_warr' style='width:55' id='WarrantyHQ_"+cdArr[0]+"'/></li>"+
										"<li ><input type='text'   value=''  class='empty_warr' style='width:55' id='WarrantyHCE_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='empty_warr' style='width:55'  id='WarrantyOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='empty_warr' style='width:55' id='WarrantyOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
									"<td style='display:none'><div><ul style='list-style-type:none'>"+
									"<li style='display:none'><input id='quoteCOStatus_"+cdArr[0]+"' type='text'   value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHQStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHCEStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHQStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHCEStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"</ul></td>")
								.append(
												"<td><div><ul style='list-style-type:none'>"+
												"<li><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteCO\")' id='quoteCO_" + cdArr[0]+"_Btn'/></li>"+
												"<li><input type='button'  value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHQ\")' id='quoteHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHCE\")' id='quoteHCE_" + cdArr[0]+"_Btn'/></li>"+
												"<li><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHQ\")' id='quoteOtherHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHCE\")' id='quoteOtherHCE_" + cdArr[0]+"_Btn'/></li>"+
												"</ul></td>");
						
							}
							$("table[id='" + tableId + "'] tr:last").append(
								"<td style='display:none'><input type='text' name='oper' value='edit' style='width:55px'/></td>");
							
							setQuoteDatas(cdArr[0], quoteDatasArray);
							
							setQuoteStatusDatas(cdArr[0],cdArr[1],quoteStatusDatasArray);
							
						}
				);
	}

	//return JSON.stringify(checkDataArray);
}

function analysiseGbRstPsInputBillImage(gbRst, params, tableId, ckArrayPs, hiddenFiles,partsCodeFiled,
		statusFile,imageFile, ptparams, quoteDatas,quoteStatus, bErrorBox, bSuccessBox, textName) {
	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	// hiddenFilesArr用来存放隐藏域的索引
	var hfCount = 0;
	var hiddenFilesArr = new Array(hiddenFiles.length);
	$(hiddenFiles).each(function(index, hfData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == hfData) {
				hiddenFilesArr[hfCount++] = hIndex;
			}
		});
	});
	//新增明细图片域
	var imgCount = 0;
	var imgFilesArr = new Array(imageFile.length);
	$(imageFile).each(function(index, ffData) {
		$.each(rst.result.head, function(imgIndex, fffData) {
			if (fffData == ffData) {
				imgFilesArr[imgCount++] = imgIndex;
			}
		});
	});
	// ptTypeId
	var ptTypeCount = 0;
	var ptTypeIdFilesArr = new Array(ptparams.length);
	$(ptparams).each(function(index, ptData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ptData) {
				ptTypeIdFilesArr[ptTypeCount++] = hIndex;
			}
		});
	});
	// checkbox包含多个参数
	var ckArray = new Array();// 用来存储checkbox中多个参数的索引
	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {
				ckArray[ckCount++] = hIndex;
			}
		});
	});
	// 报价状态
	var statusCount = 0;
	var statusFileArr = new Array(statusFile.length);
	$(statusFile).each(function(index, sData) {
		$.each(rst.result.head, function(rfIndex, rfData) {
			if (rfData == sData) {
				statusFileArr[statusCount++] = rfIndex;
			}
		});
	});
	// 报价状态
	var mustInputCount = 0;
	var mIFileArr = new Array(partsCodeFiled.length);
	$(partsCodeFiled).each(function(index, sData) {
		$.each(rst.result.head, function(rfIndex, rfData) {
			if (rfData == sData) {
		
				mIFileArr[mustInputCount++] = rfIndex;
			}
		});
		//alert(mIFileArr[0]);
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var phArray = new Array();
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData.toLowerCase() == hData.toLowerCase()) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	//处理报价情况
	var qdArray = new Array();
	var qdCount = 0;
	if (quoteDatas != null) {
		$(quoteDatas).each(function(qdIndex, qdData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (qdData.toLowerCase() == hData.toLowerCase()) {
					qdArray[qdCount++] = hIndex;
				}
			});
		});
	}
	//单独处理报价状态
	var quoteStatusArray  = new Array();
	var quoteStausCount = 0;
	if(quoteStatus!=null){
		//将quoteStaus转换成一个数组
			$.each(rst.result.head, function(hIndex, hData) {
				if (quoteStatus[0].toLowerCase() == hData.toLowerCase()) {
					quoteStatusArray[0] = hIndex;
				}
			});
	}
	if (rst.result.data != null) {
		$
				.each(
						rst.result.data,
						function(index, dt) {
							$("table[id='" + tableId + "']")
									.append("<tr></tr>");
							//var checkDataArray = new Array();
							//var cdaCount = 0;
							var checkData = "";
							var quoteDatasArray = new Array(12);
							var qdaCount = 0;
							var quoteStatusDatasArray = new Array(5);
							var qstdaCount = 0;
							$(ckArray).each(function(ckIndex, ckData) {
								var m = ckArray.length - 1;
								$.each($(dt), function(ddtIndex, ddl) {
									if (ddtIndex == ckData) {
										if (ckIndex < m) {
											checkData += ddl + ",";
										} else {
											checkData += ddl;
											return false;
										}

									}
								});
							});
							//可用数组的push方法替代
							//checkDataArray[cdaCount++] = checkData;
							
							var cdArr = checkData.split(",");
							
							$("table[id='"+ tableId+ "'] tr:last").append("<td><input type='checkBox' value='" + cdArr[0]+ "|"+cdArr[2]+"'/></td><td></td>");
							var detailStatus=0; 
							$(phArray)
									.each(
											function(phIndex, data) {
												$
														.each(
																$(dt),
																function(
																		dtIndex,
																		d) {
																	if (dtIndex == data) {
																		// <隐藏域>
																		if (isHiddenFile(
																				hiddenFilesArr,
																				data)) {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td style='display:none'><div id='quoteOption_"
																									+ data
																									+ "_"
																									+ d
																									+ "'><input value='"
																									+ (d === null ? " "
																											: (d === 'null' ? " "
																													: d))
																									+ "' style='width:55'></div></td>");
																		
																			// <报价信息数据>
																		} else if (isHiddenFile(
																				qdArray,
																				data)) {
																			quoteDatasArray[qdaCount++] = d;
																		} 
																		else if (isHiddenFile(
																				quoteStatusArray,
																				data)) {
																			quoteStatusDatasArray[0] =d.substr(0,1) ;
																			quoteStatusDatasArray[1] =d.substr(1,1) ;
																			quoteStatusDatasArray[2] =d.substr(2,1) ;
																			quoteStatusDatasArray[3] =d.substr(3,1) ;
																			quoteStatusDatasArray[4] =d.substr(4,1) ;
																		} 
																		else if (isHiddenFile(mIFileArr,data)) {
																			//需求数量特殊处理
																			if(data==5){
																			$("table[id='"+ tableId+ "'] tr:last")
																			.append("<td><div id='quoteOption_"+ data+ "_"+ d+ "'><input type='text' id='needCount_"+cdArr[0]+"' onkeydown='partsNameinfo(this,this.value);' class='notEmpty' value='"+ (d === null ? " ": (d === 'null' ? " ": d))+ "'/></div></td>");
																			}
																			else if(data==6){
																			$("table[id='"+ tableId+ "'] tr:last")
																			.append("<td><div id='quoteOption_"+ data+ "_"+ d+ "'><input type='text' id='partsCode_"+cdArr[0]+"' class='notEmpty_warr' value='"+ (d === null ? " ": (d === 'null' ? " ": d))+ "'/></div></td>");
																			}else if(data==4){
																			$("table[id='"+ tableId+ "'] tr:last")
																			.append("<td><div id='quoteOption_"+ data+ "_"+ d+ "'><input type='text' id='partsCode_"+cdArr[0]+"' class='notEmpty' value='"+ (d === null ? " ": (d === 'null' ? " ": d))+ "'/></div></td>");}
																			else if(data==17){
																			$("table[id='"+ tableId+ "'] tr:last")
																			.append("<td><div id='quoteOption_"+ data+ "_"+ d+ "'><input type='text' id='partsCode_"+cdArr[0]+"' class='empty' value='"+ (d === null ? " ": (d === 'null' ? " ": d))+ "'/></div></td>");}
																			
																		} 
																		else if (isHiddenFile(imgFilesArr,data)) {
																			if (d == null || d=="" || d==undefined || d=='') {
																				$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>无</td>");
																			} else {
																				$("table[id='"+ tableId+ "'] tr:last").append(
																								"<td width='103'><a  href='"+ d+ "' target='blank'>查看</a></td>");
																			}
																		}
																		else if (isHiddenFile(
																				statusFileArr,
																				data)) {
																			detailStatus = d;
																			switch (d) {
																			case 0:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																								.append("<td style='display:none'><div id='quoteOption_"+ data+ "_"+ d+"'><input  id='startQuoteStatus_"+cdArr[0]+"' style='width:55;text-align:center' value='保存' readonly='readonly'></input><span style='display:none' id='startQuoteStatusId_"+cdArr[0]+"'>0</span></div></td>");
																			break;
																			case 1:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																								.append("<td style='display:none'><div id='quoteOption_"+ data+ "_"+ d+"'><input  id='startQuoteStatus_"+cdArr[0]+"' style='width:55;text-align:center' value='发布' readonly='readonly'></input><span style='display:none' id='startQuoteStatusId_"+cdArr[0]+"'>1</span></div></td>");
																			break;
																			case 5:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																					
																	
																								.append("<td style='display:none'><div id='quoteOption_"+ data+ "_"+ d+"'><input  id='startQuoteStatus_"+cdArr[0]+"' style='width:55;text-align:center' value='取消' readonly='readonly'></input><span style='display:none' id='startQuoteStatusId_"+cdArr[0]+"'>5</span></div></td>");
																				break;
																			case 8:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																								.append("<td style='display:none'><div id='quoteOption_"+ data+ "_"+ d+"'><input  id='startQuoteStatus_"+cdArr[0]+"' style='width:55;text-align:center' value='确定报价' readonly='readonly'></input><span style='display:none' id='startQuoteStatusId_"+cdArr[0]+"'>8</span></div></td>");
																			break;
																			default:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																								.append("<div id='quoteOption_"+ data+ "_"+ d+"'><input  id='startQuoteStatus_"+cdArr[0]+"' style='width:55;text-align:center' value='取消' readonly='readonly'></input><span style='display:none' id='startQuoteStatusId_"+cdArr[0]+"'>0</span></div></td>");
																			break;

																			}

																		}
																		// <厂商类别>
																		else if (isHiddenFile(
																				ptTypeIdFilesArr,
																				data)) {
																				
																			switch (d) {
																			case 1:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																						.append(
																								"<td><div id='quoteOption_"
																										+ data
																										+ "_"
																										+ d
																										+ "'><span style='display:none' id='ptFactTpId_"+cdArr[0]+"'>"
																										+ d
																										+ "</span>原厂</div></td>");
																				break;
																			case 2:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																						.append(
																								"<td><div id='quoteOption_"
																										+ data
																										+ "_"
																										+ d
																										+ "'><span style='display:none' id='ptFactTpId_"+cdArr[0]+"'>"
																										+ d
																										+ "</span>配套厂</div></td>");
																				break;
																			case 3:
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																						.append(
																								"<td><div id='quoteOption_"
																										+ data
																										+ "_"
																										+ d
																										+ "'><span style='display:none' id='ptFactTpId_"+cdArr[0]+"'>"
																										+ d
																										+ "</span>其他厂</div></td>");
																				break;
																				
																			case 4:
																				$("table[id='"+ tableId	+ "'] tr:last")
																				.append("<td><div id='quoteOption_"	+ data+ "_"+ d+ "'><span style='display:none' id='ptFactTpId_"+cdArr[0]+"'>"+ d+"</span>全部</div></td>");
																			break;

																			}

																		}// <普通域>
																		else {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td><div id='quoteOption_"
																									+ data
																									+ "_"
																									+ d
																									+ "'><input type='text' class='white' disabled='disabled'  value='"
																									+ (d === null ? " "
																											: (d === 'null' ? " "
																													: d))
																									+ "'/></div></td>");

																		}
																	}
																});

											});
							if (cdArr[1]== 1) {
								$("table[id='" + tableId + "'] tr:last")	
								.append(
										"<td><span id='num_"+cdArr[0]+"' style='display:none'>4</span><div><ul style='list-style-type:none'>"+
										"<li>原厂</li>"+
										"<li style='display:none'>高品质(配)</li>"+
										"<li style='display:none'>高性价比(配)</li>"+
										"<li style='display:none'>高品质(其他)</li>"+
										"<li style='display:none'>高性价比(其他)</li>"+
										"</ul></div></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li><input type='text'   value=''  style='width:55' class='notEmpty_quote' id='quoteCO_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly' style='width:55' id='quoteHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly' style='width:55' id='quoteHCE_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly' style='width:55' id='quoteOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly' style='width:55' id='quoteOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li>&nbsp;</li>"+
										"<li style='display:none'><input type='text'   value='' readonly='readonly' disabled='disabled' style='width:55' id='BrandHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='' readonly='readonly' disabled='disabled' style='width:55' id='BrandHCE_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='' readonly='readonly' disabled='disabled' style='width:55' id='BrandOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='' readonly='readonly' disabled='disabled' style='width:55' id='BrandOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li>&nbsp;</li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly' style='width:55'  id='WarrantyHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly'  style='width:55' id='WarrantyHCE_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly' style='width:55'  id='WarrantyOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' readonly='readonly'  style='width:55' id='WarrantyOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
									"<td style='display:none'><div><ul style='list-style-type:none'>"+
									"<li style='display:none'><input id='quoteCOStatus_"+cdArr[0]+"' type='text'   value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHQStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHCEStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHQStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHCEStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"</ul></td>")
								.append(
												"<td><div><ul style='list-style-type:none'>"+
												"<li><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteCO\")' id='quoteCO_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button'  value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHQ\")' id='quoteHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHCE\")' id='quoteHCE_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHQ\")' id='quoteOtherHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHCE\")' id='quoteOtherHCE_" + cdArr[0]+"_Btn'/></li>"+
												"</ul></td>");
							
							
							
							}//配件类型非原厂
							else if(cdArr[1]== 2) {
								$("table[id='" + tableId + "'] tr:last")
								.append(
										"<td><span id='num_"+cdArr[0]+"' style='display:none'>3</span><div><ul style='list-style-type:none'>"+
										"<li style='display:none'>原厂</li>"+
										"<li >高品质(配)</li>"+
										"<li >高性价比(配)</li>"+
										"<li style='display:none'>高品质(其他)</li>"+
										"<li style='display:none'>高性价比(其他)</li>"+
										"</ul></div></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='quoteCO_"+cdArr[0]+"' readonly='readonly'/></li>"+
										"<li><input type='text' class='notEmpty_quote'  value=''  style='width:55' id='quoteHQ_"+cdArr[0]+"' /></li>"+
										"<li><input type='text' class='notEmpty_quote'  value=''  style='width:55' id='quoteHCE_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' style='width:55' id='quoteOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0' style='width:55' id='quoteOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li style='display:none'><input type='text'   value=''  style='width:55' disabled='disabled'/></li>"+
										"<li><input type='text' class='notEmpty'  value=''  style='width:55' id='BrandHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' class='notEmpty'  value=''  style='width:55' id='BrandHCE_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='' readonly='readonly' disabled='disabled' style='width:55' id='BrandOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='' readonly='readonly' disabled='disabled' style='width:55' id='BrandOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' disabled='disabled'/></li>"+
										"<li><input type='text'   value='' class='empty_warr' style='width:55' id='WarrantyHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='empty_warr' style='width:55' id='WarrantyHCE_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55'  id='WarrantyOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='WarrantyOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
										.append(
									"<td style='display:none'><div><ul style='list-style-type:none'>"+
									"<li style='display:none'><input id='quoteCOStatus_"+cdArr[0]+"' type='text'   value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHQStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHCEStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHQStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHCEStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"</ul></td>")
										.append(
												"<td><div><ul style='list-style-type:none'>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteCO\")' id='quoteCO_" + cdArr[0]+"_Btn'/></li>"+
												"<li ><input type='button'  value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHQ\")' id='quoteHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li ><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHCE\")' id='quoteHCE_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHQ\")' id='quoteOtherHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHCE\")' id='quoteOtherHCE_" + cdArr[0]+"_Btn'/></li>"+
												"</ul></td>");
							}else if(cdArr[1]== 3){
								$("table[id='" + tableId + "'] tr:last")
								.append(
										"<td><span id='num_"+cdArr[0]+"' style='display:none'>3</span><div><ul style='list-style-type:none'>"+
										"<li style='display:none'>原厂</li>"+
										"<li style='display:none'>高品质(配)</li>"+
										"<li style='display:none'>高性价比(配)</li>"+
										"<li >高品质(其他)</li>"+
										"<li >高性价比(其他)</li>"+
										"</ul></div></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='quoteCO_"+cdArr[0]+"' readonly='readonly'/></li>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='quoteHQ_"+cdArr[0]+"' /></li>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='quoteHCE_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' value='' class='notEmpty_quote' style='width:55' id='quoteOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' value='' class='notEmpty_quote' style='width:55' id='quoteOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li style='display:none'><input type='text'   value=''  style='width:55' disabled='disabled'/></li>"+
										"<li style='display:none'><input type='text'   value=''  style='width:55' id='BrandHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value=''  style='width:55' id='BrandHCE_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='notEmpty' style='width:55' id='BrandOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='notEmpty' style='width:55' id='BrandOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' disabled='disabled'/></li>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='WarrantyHQ_"+cdArr[0]+"'/></li>"+
										"<li style='display:none'><input type='text'   value='0'  style='width:55' id='WarrantyHCE_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' class='empty_warr'  value='' style='width:55'  id='WarrantyOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' class='empty_warr' value='' style='width:55' id='WarrantyOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
										.append(
									"<td style='display:none'><div><ul style='list-style-type:none'>"+
									"<li style='display:none'><input id='quoteCOStatus_"+cdArr[0]+"' type='text'   value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHQStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHCEStatus_"+cdArr[0]+"'  value='0'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHQStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHCEStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"</ul></td>")
										.append(
												"<td><div><ul style='list-style-type:none'>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteCO\")' id='quoteCO_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button'  value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHQ\")' id='quoteHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li style='display:none'><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHCE\")' id='quoteHCE_" + cdArr[0]+"_Btn'/></li>"+
												"<li ><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHQ\")' id='quoteOtherHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li ><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHCE\")' id='quoteOtherHCE_" + cdArr[0]+"_Btn'/></li>"+
												"</ul></td>");
							}
							else if(cdArr[1]== 4){
								$("table[id='" + tableId + "'] tr:last")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li>原厂</li>"+
										"<li>高品质(配)</li>"+
										"<li>高性价比(配)</li>"+
										"<li>高品质(其他)</li>"+
										"<li>高性价比(其他)</li>"+
										"</u></div></td>")
								.append(
										"<td><span id='num_"+cdArr[0]+"' style='display:none'>0</span><div><ul style='list-style-type:none'>"+
										"<li ><input type='text'   value='' class='notEmpty_quote'  style='width:55' id='quoteCO_"+cdArr[0]+"'/></li>"+
										"<li ><input type='text'   value='' class='notEmpty_quote' style='width:55' id='quoteHQ_"+cdArr[0]+"' /></li>"+
										"<li ><input type='text'   value='' class='notEmpty_quote' style='width:55' id='quoteHCE_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' value='' class='notEmpty_quote' style='width:55' id='quoteOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text' value='' class='notEmpty_quote' style='width:55' id='quoteOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li>&nbsp;</li>"+
										"<li><input type='text'   value='' class='notEmpty' style='width:55' id='BrandHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='notEmpty' style='width:55' id='BrandHCE_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='notEmpty' style='width:55' id='BrandOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='notEmpty' style='width:55' id='BrandOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
										"<td><div><ul style='list-style-type:none'>"+
										"<li  >&nbsp;</li>"+
										"<li ><input type='text'   value=''  class='empty_warr' style='width:55' id='WarrantyHQ_"+cdArr[0]+"'/></li>"+
										"<li ><input type='text'   value=''  class='empty_warr' style='width:55' id='WarrantyHCE_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='empty_warr' style='width:55'  id='WarrantyOtherHQ_"+cdArr[0]+"'/></li>"+
										"<li><input type='text'   value='' class='empty_warr' style='width:55' id='WarrantyOtherHCE_"+cdArr[0]+"'/></li>"+
										"</ul></td>")
								.append(
									"<td style='display:none'><div><ul style='list-style-type:none'>"+
									"<li style='display:none'><input id='quoteCOStatus_"+cdArr[0]+"' type='text'   value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHQStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteHCEStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHQStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"<li style='display:none'><input type='text' id='quoteOtherHCEStatus_"+cdArr[0]+"'  value='1'/></li>"+
									"</ul></td>")
								.append(
												"<td><div><ul style='list-style-type:none'>"+
												"<li><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteCO\")' id='quoteCO_" + cdArr[0]+"_Btn'/></li>"+
												"<li><input type='button'  value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHQ\")' id='quoteHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteHCE\")' id='quoteHCE_" + cdArr[0]+"_Btn'/></li>"+
												"<li><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHQ\")' id='quoteOtherHQ_" + cdArr[0]+"_Btn'/></li>"+
												"<li><input type='button' value='不报价' onclick='javascript:cancle("+ cdArr[0] +","+cdArr[1]+",\"quoteOtherHCE\")' id='quoteOtherHCE_" + cdArr[0]+"_Btn'/></li>"+
												"</ul></td>");
						
							}
							$("table[id='" + tableId + "'] tr:last").append("<td style='display:none'><input type='text' name='oper' value='edit' style='width:55px'/></td>");
							
							setQuoteDatas(cdArr[0], quoteDatasArray);
							
							setQuoteStatusDatas(cdArr[0],cdArr[1],quoteStatusDatasArray);
							
						}
				);
	}

	//return JSON.stringify(checkDataArray);
}
/*
function cancle(id,ptFactId) {
	alert($("#startQuoteStatusId_" + id).html());
	if ($("#startQuoteStatusId_" + id).html() == 1) {
		if (confirm("确认取消报价吗?")) {
			$("#startQuoteStatusId_" + id).html(5);
			$("#startQuoteStatus_" + id).val("已取消 ");
			$("input[id='partsCode_"+id+"']").removeClass("notEmpty");
			$("input[id='partsCode_"+id+"']").attr("disabled","disabled");
			$("input[id^='quote'][id$='"+id+"']:visible").removeClass("notEmpty");
			$("input[id^='quote'][id$='"+id+"']").val(0);
			$("input[id^='quote'][id$='"+id+"']").attr("disabled","disabled");
			$("input[id^='Brand'][id$='"+id+"']:visible").removeClass("notEmpty");
			$("input[id^='Brand'][id$='"+id+"']").val(" ");
			$("input[id^='Brand'][id$='"+id+"']").attr("disabled","disabled");
			$("input[id^='Warranty'][id$='"+id+"']:visible").removeClass("notEmpty");
			$("input[id^='Warranty'][id$='"+id+"']").val(0);
			$("input[id^='Warranty'][id$='"+id+"']").attr("disabled","disabled");
			$("#QuoteBtn_" + id).val("恢复 ");
		}
	} else if ($("#startQuoteStatusId_" + id).html() == 5) {
		if (confirm("确认恢复报价吗?")) {
			$("#startQuoteStatusId_" + id).html(1);
			$("#startQuoteStatus_" + id).val("默认");
			$("input[id='partsCode_"+id+"']").addClass("notEmpty");
			$("input[id='partsCode_"+id+"']").removeAttr("disabled");
			$("input[id^='quote'][id$='"+id+"']").removeAttr("disabled");
			$("input[id^='Brand'][id$='"+id+"']").removeAttr("disabled");
			$("input[id^='Warranty'][id$='"+id+"']").removeAttr("disabled");
			$("input[id^='quote'][id$='"+id+"']:visible").val("");
			$("input[id^='Warranty'][id$='"+id+"']:visible").val("");
			if(ptFactId!=4){
				$("input[id^='quote'][id$='"+id+"']:visible").addClass("notEmpty");
				$("input[id^='Brand'][id$='"+id+"']:visible").addClass("notEmpty");
				$("input[id^='Warranty'][id$='"+id+"']:visible").addClass("notEmpty");
			}
			$("#QuoteBtn_" + id).val("不报价");
		}
	}
}
*/
function isHiddenFile(hfArray, data) {
	var flag = false;
	$.each(hfArray, function(hfIndex, hfData) {
		if (hfData == data) {
			flag = true;
			return false;
		}
	});
	return flag;
}

function analysiseGbRstWithEditAndHFPs(gbRst, params, tableId, ckArrayPs,
		hiddenFiles, bErrorBox, bSuccessBox) {

	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.status == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	// checkbox包含多个参数

	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {
				ckArray[ckCount++] = hIndex;
			}
		});
	});
	// hiddenFilesArr用来存放隐藏域的索引
	var hfCount = 0;
	var hiddenFilesArr = new Array(hiddenFiles.length);
	$(hiddenFiles).each(function(index, hfData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == hfData) {
				hiddenFilesArr[hfCount++] = hIndex;
			}
		});
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	if (rst.result.data != null) {
		$
				.each(
						rst.result.data,
						function(index, dt) {
							var checkData = "";
							$("table[id='" + tableId + "']")
									.append("<tr></tr>");

							$(ckArray).each(function(ckIndex, ckData) {
								var m = ckArray.length - 1;
								$.each($(dt), function(ddtIndex, ddl) {
									if (ddtIndex == ckData) {
										if (ckIndex < m) {
											checkData += ddl + ",";
										} else {
											checkData += ddl;
											return false;
										}
									}
								});
							});
							$(phArray)
									.each(
											function(phIndex, data) {
												$
														.each(
																$(dt),
																function(
																		dtIndex,
																		d) {
																	if (dtIndex == data) {
																		if (isHiddenFile(
																				hiddenFilesArr,
																				data)) {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td style='display:none'>"
																									+ (d === null ? "未填写"
																											: (d === 'null' ? "未填写"
																													: d))
																									+ "</td>");
																		} else {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td>"
																									+ (d === null ? "未填写"
																											: (d === 'null' ? "未填写"
																													: d))
																									+ "</td>");
																		}
																	}
																});
											});

							$("table[id='" + tableId + "'] tr:last").append(
									"<td><a href='javascript:checkQuoteDetail("
											+ checkData + ")'>查看详情</a></td>");
						});
	}
}
// 带图片的特殊处理
function analysiseGbRstWithEditAndHFFPs(gbRst, params, tableId, ckArrayPs,
		hiddenFiles, fileFiles, timeFiles, recommendFiles, emStatusFile,
		bErrorBox, bSuccessBox) {
	// var rfArray = new Array();
	// var rfCount = 0;

	var timeArray = new Array();
	var tAfCount = 0;
	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	// checkbox包含多个参数

	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {
				ckArray[ckCount++] = hIndex;
			}
		});
	});
	// hiddenFilesArr用来存放隐藏域的索引
	var hfCount = 0;
	var hiddenFilesArr = new Array(hiddenFiles.length);
	$(hiddenFiles).each(function(index, hfData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == hfData) {
				hiddenFilesArr[hfCount++] = hIndex;
			}
		});
	});
	// 图片区域索引
	var ffCount = 0;
	var fileFilesArr = new Array(fileFiles.length);
	$(fileFiles).each(function(index, ffData) {
		$.each(rst.result.head, function(ffIndex, fffData) {
			if (fffData == ffData) {
				fileFilesArr[ffCount++] = ffIndex;
			}
		});
	});
	// 时间区域索引
	var timeCount = 0;
	var timeFilesArr = new Array(timeFiles.length);
	$(timeFiles).each(function(index, timeData) {
		$.each(rst.result.head, function(tfIndex, tfData) {
			if (tfData == timeData) {
				timeFilesArr[timeCount++] = tfIndex;
			}
		});
	});

	// 推荐域转化用来存放隐藏域的索引
	var rfCount = 0;
	var rfFilesArr = new Array(recommendFiles.length);
	$(recommendFiles).each(function(index, rfsData) {
		$.each(rst.result.head, function(rfIndex, rfData) {
			if (rfData == rfsData) {
				rfFilesArr[rfCount++] = rfIndex;
			}
		});
	});

	var emStausCount = 0;
	var emStatusFileArr = new Array(emStatusFile.length);
	$(emStatusFile).each(function(index, emsData) {
		$.each(rst.result.head, function(rfIndex, rfData) {
			if (rfData == emsData) {
				emStatusFileArr[emStausCount++] = rfIndex;
			}
		});
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	if (rst.result.data != null) {
		$.each(rst.result.data,function(index, dt) {
			var imagesArray = new Array();
			imageCount = 0;
			var checkData = "";
			$("table[id='" + tableId + "']").append("<tr></tr>");
	
			$(ckArray).each(function(ckIndex, ckData) {
				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});
			$(phArray).each(function(phIndex, data) {
				$.each($(dt),function(dtIndex,d) {
					if (dtIndex == data) {
						if (isHiddenFile(hiddenFilesArr,data)) {
							$("table[id='"+ tableId+ "'] tr:last").append("<td style='display:none'>"
													+ (d === null ? "未填写": d)+ "</td>");
						} else if (isHiddenFile(fileFilesArr,data)) {
							if (d == null || d=="" || d==undefined || d=='') {
								$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>无图片</td>");
								imagesArray[imageCount++] = 0;
							} else {
								/*
								 * $(
								 * "table[id='" +
								 * tableId +
								 * "']
								 * tr:last")
								 * .append( "<td width='103'><a
								 * class='fancybox'
								 * href='"+d+"'>查看</a></td>");
								 */
								$("table[id='"+ tableId+ "'] tr:last").append(
												"<td width='103'><a  href='"+ d+ "' target='blank'>查看</a></td>");
								imagesArray[imageCount++] = d;
							}
						} else if (isHiddenFile(timeFilesArr,data)) {
							if (d != null) {
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103' ><div id='quoteRestTime_"
													+ tAfCount+ "'>"+ d+ "</div>"+tAfCount+"</td>");
							timeArray[tAfCount++] = d;
						}
					} else if (isHiddenFile(emStatusFileArr,data)) {
						d = (d == 'null' ? -1: (d == null ? -1: d));
						switch (d) {
						case -1:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>未填写</td>");
							break;
						case 0:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>保存</td>");
							break;
						case 1:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>发布</td>");
							break;
						case 2:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>匹配中</td>");
							break;
						case 3:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>匹配成功</td>");
							break;
						case 4:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>匹配失败</td>");
							break;
						case 5:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>取消</td>");
							break;
						case 6:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>报价中</td>");
							break;
						case 7:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>询价结束</td>");
							break;
						case 8:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>确定报价</td>");
							break;
						case 9:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>转订单</td>");
							break;
						case 10:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>失效</td>");
							break;
						}

					} else if (isHiddenFile(rfFilesArr,data)) {
						/*
						 * if
						 * (d
						 * ===
						 * null) { $(
						 * "table[id='" +
						 * tableId +
						 * "']
						 * tr:last")
						 * .append( "<td></td>"); }
						 * else { $(
						 * "table[id='" +
						 * tableId +
						 * "']
						 * tr:last")
						 * .append( "<td><img
						 * src='" +
						 * d +
						 * "'/></td>"); }
						 */
						switch (d) {
						case 1:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>客户指定</td>");
							break;
						case 2:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>平台匹配</td>");
							break;
						case 3:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>主动查找</td>");
							break;
						default:$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>未知</td>");
						break;
						}
					} else {
						$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>"+ (d === null ? "未填写": d)+ "</td>");
					}
				}

			});

			});

			$("table[id='" + tableId + "'] tr:last").append(
					"<td width='103'><a href=\"javascript:checkQuoteDetail("
							+ checkData + ",'" + imagesArray
							+ "')\">查看详情</a></td>");
			// alert( typeof imagesArray[1]);
		});
	}

	$("#timeArray").val(timeArray);
	getRestTime1();
}
/*
 * getRestTime(); function getRestTime() { var expiredTime = "2013-09-20
 * 00:00:00"; var regEx = new RegExp("\\-", "gi"); expiredTime =
 * expiredTime.replace(regEx, "/"); var EndTime = Date.parse(expiredTime); var
 * NowTime = new Date(); var nMS = EndTime - NowTime.getTime(); var nD =
 * Math.floor(nMS / (1000 * 60 * 60 * 24)); var nH = Math.floor(nMS / (1000 * 60 *
 * 60)) % 24; var nM = Math.floor(nMS / (1000 * 60)) % 60; var nS =
 * Math.floor(nMS / 1000) % 60; $("div[name='quoteRestTime']").html( nD + '天' +
 * nH + '时' + nM + '分' + nS + '秒'); setTimeout(arguments.callee, 1000); }
 */
/* getRestTime1(); */
function getRestTime1() {
	var expiredTimes = $("#timeArray").val();
	expiredTimes = expiredTimes.split(",");
	$(expiredTimes).each(
			function(index, data) {
				
				
				var expiredTime = data;
				var regEx = new RegExp("\\-", "gi");
				if (expiredTime != undefined) {
					var et = expiredTime.replace(regEx, "/");
					var EndTime = Date.parse(et);
					var NowTime = new Date();
					//
					var nMS =  EndTime - NowTime.getTime() ;
					if (nMS > 0) {
						var nD = Math.floor(nMS / (1000 * 60 * 60 * 24));
						var nH = Math.floor(nMS / (1000 * 60 * 60)) % 24;
						var nM = Math.floor(nMS / (1000 * 60)) % 60;
						var nS = Math.floor(nMS / 1000) % 60;
						/*
						 * $("div[id='quoteRestTime']").html( nD + '天' + nH +
						 * '时' + nM + '分' + nS + '秒');
						 */
						$("#quoteRestTime_" + index).html(
								//(nD <= 9 ? ("0" + nD) : nD) + '天'+
										 (nH <= 9 ? ("0" + nH) : nH) + ':'
										+ (nM <= 9 ? ("0" + nM) : nM) + ':'
										+ (nS <= 9 ? ("0" + nS) : nS));
					} else {
						$("#quoteRestTime_" + index).html("已过期");
					}

					/*
					 * $("#quoteRestTime_"+index).html( nD + '天' + nH + '时' + nM +
					 * '分' + nS + '秒'); }else{ $("#quoteRestTime_"+index).html(
					 * "已过期"); }
					 */
				}
			});
	setTimeout(arguments.callee, 1000);
}

function analysiseGbRstPsImage(gbRst, params, tableId, ckArrayPs, hiddenFiles,
		fileFiles, url, bErrorBox, bSuccessBox, textName, divId, mainId) {
	var rst = JSON.parse(gbRst);
	var msg = null;
	var checkDataArray = new Array();
	var cdaCount = 0;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	// checkbox包含多个参数

	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {

				ckArray[ckCount++] = hIndex;
			}
		});
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	// 图片区域用来存放隐藏域的索引
	var ffCount = 0;
	var fileFilesArr = new Array(fileFiles.length);
	$(fileFiles).each(function(index, ffData) {
		$.each(rst.result.head, function(ffIndex, fffData) {
			if (fffData == ffData) {
				fileFilesArr[ffCount++] = ffIndex;
			}
		});
	});

	// hiddenFilesArr用来存放隐藏域的索引
	var hfCount = 0;
	var hiddenFilesArr = new Array(hiddenFiles.length);
	$(hiddenFiles).each(function(index, hfData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == hfData) {
				hiddenFilesArr[hfCount++] = hIndex;
			}
		});
	});

	if (rst.result.data != null) {
		$
				.each(
						rst.result.data,
						function(index, dt) {
							// if (index <= rst.result.data.length) {
							$("table[id='" + tableId + "']")
									.append("<tr></tr>");
							// }
							var checkData = "";
							$(ckArray).each(function(ckIndex, ckData) {
								var m = ckArray.length - 1;
								$.each($(dt), function(ddtIndex, ddl) {
									if (ddtIndex == ckData) {
										if (ckIndex < m) {
											checkData += ddl + ",";
										} else {
											
											checkData += ddl;
											return false;
										}

									}
								});
							});
							checkDataArray[cdaCount++] = checkData;
							$(phArray)
									.each(
											function(phIndex, data) {
												$
														.each(
																$(dt),
																function(
																		dtIndex,
																		d) {
																	if (dtIndex == data) {

																		if (isHiddenFile(
																				fileFilesArr,
																				data)) {
																			/*if (d == null || d== undefined || d=='' || d=="") {*/
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																						.append(
																								"<td width='103'>无</td>");
																			/*} else {
																				
																				 * $(
																				 * "table[id='" +
																				 * tableId +
																				 * "']
																				 * tr:last")
																				 * .append( "<td width='103'><a
																				 * class='fancybox'
																				 * href='"+d+"'>查看</a></td>");
																				 
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																						.append(
																								"<td width='103'><a  href='"
																										+ d
																										+ "' target='blank'>查看</a></td>");

																				;

																			}*/

																		} else if (isHiddenFile(
																				hiddenFilesArr,
																				data)) {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td style='display:none'>"
																									+ (d === null ? "未填写"
																											: d)
																									+ "</td>");

																		} else {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td>"
																									+ (d === null ? "未填写"
																											: d)
																									+ "</td>");
																		}
																	}
																});
											});
						});

	}
	// 定义一个变量区分
	return JSON.stringify(checkDataArray);
}

//------------------------------lss----------------------------------------------
function analysiseGbRstWithEditAndHref(gbRst, params, tableId,url,ckArrayPs,
		hrefFiles, bErrorBox, bSuccessBox) {

	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	// checkbox包含多个参数

	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {
				ckArray[ckCount++] = hIndex;
			}
		});
	});
	// hiddenFilesArr用来存放隐藏域的索引
	var hfCount = 0;
	var hiddenFilesArr = new Array(hrefFiles.length);
	$(hrefFiles).each(function(index, hfData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == hfData) {
				hiddenFilesArr[hfCount++] = hIndex;
			}
		});
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	if (rst.result.data != null) {
		$
				.each(
						rst.result.data,
						function(index, dt) {
							var checkData = "";
							$("table[id='" + tableId + "']")
									.append("<tr></tr>");

							$(ckArray).each(function(ckIndex, ckData) {
								var m = ckArray.length - 1;
								$.each($(dt), function(ddtIndex, ddl) {
									if (ddtIndex == ckData) {
										if (ckIndex < m) {
											checkData += ddl + ",";
										} else {
											checkData += ddl;
											return false;
										}
									}
								});
							});
							$(phArray)
									.each(
											function(phIndex, data) {
												$
														.each(
																$(dt),
																function(
																		dtIndex,
																		d) {
																	if (dtIndex == data) {
																		if (isHiddenFile(
																				hiddenFilesArr,
																				data)) {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td><a href='"+href+"'>"
																									+ (d === null ? "未填写"
																											: (d === 'null' ? "未填写"
																													: d))
																									+ "</a></td>");
																		} else {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td>"
																									+ (d === null ? "未填写"
																											: (d === 'null' ? "未填写"
																													: d))
																									+ "</td>");
																		}
																	}
																});
											});

							$("table[id='" + tableId + "'] tr:last").append(
									"<td><a href=\"javascript:edit('" + url + "'," + checkData
											+ ")\">编辑</a></td>");
						});
	}
}
//处理未发布的询价单
function analysiseGbRstWithEditNoPublish(gbRst, params, tableId, ckArrayPs,
		hiddenFiles, fileFiles,hrefStr,pageIndex,pageSize,bErrorBox, bSuccessBox) {
	// var rfArray = new Array();
	// var rfCount = 0;
	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();
	// checkbox包含多个参数
	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {
				ckArray[ckCount++] = hIndex;
			}
		});
	});
	
	var hrefIndex="";
	$.each(rst.result.head, function(hIndex, hData) {
		if (hrefStr == hData) {
			hrefIndex = hIndex;
		}
	});
	
	
	// hiddenFilesArr用来存放隐藏域的索引
	var hfCount = 0;
	var hiddenFilesArr = new Array(hiddenFiles.length);
	$(hiddenFiles).each(function(index, hfData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == hfData) {
				hiddenFilesArr[hfCount++] = hIndex;
			}
		});
	});
	// 图片区域索引
	var ffCount = 0;
	var fileFilesArr = new Array(fileFiles.length);
	$(fileFiles).each(function(index, ffData) {
		$.each(rst.result.head, function(ffIndex, fffData) {
			if (fffData == ffData) {
				fileFilesArr[ffCount++] = ffIndex;
			}
		});
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	var detailCount = 0;
	if (rst.result.data != null) {
		$.each(rst.result.data,function(index, dt) {
			var imagesArray = new Array();
			imageCount = 0;
			var checkData = "";
			$("table[id='" + tableId + "']").append("<tr></tr>");
			$("table[id='"+ tableId+ "'] tr:last").append("<td width='40'>"+((++detailCount)+pageIndex*pageSize)+"</td>");
			$(ckArray).each(function(ckIndex, ckData) {
				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});
			
			$(phArray).each(function(phIndex, data) {
				$.each($(dt),function(dtIndex,d) {
					
					if (dtIndex == data) {
						if (isHiddenFile(hiddenFilesArr,data)) {
							$("table[id='"+ tableId+ "'] tr:last").append("<td style='display:none'>"
													+ (d === null ? " ": d)+ "</td>");
						} else if (isHiddenFile(fileFilesArr,data)) {
							if (d === null || d==="" || d===undefined || d==='' )
							{	
								$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>无图片</td>");
								imagesArray[imageCount++] = 0;
							} else {
								
								$("table[id='"+ tableId+ "'] tr:last").append(
												"<td class='chakanxiangqing' width='103'><a  href='"+ d+ "' target='blank'>查看</a></td>");
								imagesArray[imageCount++] = d;
							}

						}else {
							
							if (d === null || d==="" || d===undefined || d==='' ){
								$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>&nbsp;</td>");
								
							}else if(dtIndex==hrefIndex){
								$("table[id='" + tableId + "'] tr:last").append(
										"<td  width='103'><a href=\"javascript:checkReceiptDetail("
												+ checkData +")\">"+d+"</a></td>");
							}
							else{
								$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>"+d+ "</td>");
							}
					}
				}
			});
			});
			$("table[id='" + tableId + "'] tr:last").append(
					"<td class='chakanxiangqing' width='103'><a href=\"javascript:checkReceiptDetail("
							+ checkData +")\">查看详情</a></td>");
			// alert( typeof imagesArray[1]);
		});
	}
}
function unPublishCheckQuoteWithEditBox(gbRst, params,chArrayps,hiddenFileds,imageFiles,selectFileds,tableId){
	var rst = JSON.parse(gbRst);
	var phArray = new Array();  //用来存储页面显示的字段索引
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	
	var ckArray = new Array();// 用来存储checkbox中多个参数的索引
	var ckCount = 0;
	$(chArrayps).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {
				ckArray[ckCount++] = hIndex;
			}
		});
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	// 图片区域索引
	var imgCount = 0;
	var imageFilesArr = new Array(imageFiles.length);
	$(imageFiles).each(function(index, ffData) {
		$.each(rst.result.head, function(ffIndex, fffData) {
			if (fffData == ffData) {
				imageFilesArr[imgCount++] = ffIndex;
			}
		});
	});
	// select区域索引
	var selectCount = 0;
	var selectFiledsArr = new Array(selectFileds.length);
	$(selectFileds).each(function(index, ffData) {
		$.each(rst.result.head, function(ffIndex, fffData) {
			if (fffData == ffData) {
				selectFiledsArr[selectCount++] = ffIndex;
			}
		});
	});
	// select区域索引
	var hiddenCount = 0;
	var hiddenFiledsArr = new Array(hiddenFileds.length);
	$(hiddenFileds).each(function(index, hfData) {
		$.each(rst.result.head, function(ffIndex, fffData) {
			if (fffData == hfData) {
				hiddenFiledsArr[hiddenCount++] = ffIndex;
			}
		});
	});
	var num=0;
	if (rst.result.data != null) {
		$.each(rst.result.data,function(index, dt) {
			num++;
			var imagesArray = new Array();
			var imageCount = 0;
			var checkData = "";
			$(ckArray).each(function(ckIndex, ckData) {
				var m = ckArray.length-1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});
			
			//$("table[id='" + tableId + "'] tr:last").append("<td></td>");
			$("table[id='" + tableId + "']").append("<tr id='tr-"+num+"'><td width='53'><input type='checkBox' value='" + checkData+ "'/></td><td></td></tr>");
			$(phArray).each(function(phIndex, data) {
				
				$.each($(dt),function(dtIndex,d) {
					if (dtIndex == data) {
						if (isHiddenFile(imageFilesArr,data)){
							if (d === null || d ===''||d === undefined || d=== "" || d ==='null') {
								$("table[id='"+ tableId+ "'] tr:last").append("<td><input type='file' id='detl_"+(checkData)+"' name='"+(checkData)+"'/></td>");
								imagesArray[imageCount++] = 0;
							} else {
								$("table[id='"+ tableId+ "'] tr:last").append(
												"<td><a  href='"+ d+ "' target='blank'>查看</a><input type='file' id=detl_'"+(checkData)+"' name='"+(checkData)+"'/></td>");
								imagesArray[imageCount++] = d;
							}
						}
						else if (isHiddenFile(hiddenFiledsArr,data)){
								$("table[id='"+ tableId+ "'] tr:last").append(
												"<td style='display:none'>"+ d+ "</td>");
								imagesArray[imageCount++] = d;
						}
						else if(isHiddenFile(selectFiledsArr,data)){
							if(d==1){
								$("table[id='"+ tableId+ "'] tr:last").append("<td><select id='ptFactTpId_"+checkData+"'><option value='1' selected>原装厂</option><option value='2'>配套厂</option><option value='3'>其他厂</option><option value='4'>全部</option></select></td>");
								
							}else if(d==2){
									$("table[id='"+ tableId+ "'] tr:last").append("<td><select id='ptFactTpId_"+checkData+"'><option value='1' >原装厂</option><option value='2' selected>配套厂</option><option value='3'>其他厂</option><option value='4'>全部</option></select></td>");
									
							}
							else if(d==3){
								$("table[id='"+ tableId+ "'] tr:last").append("<td><select id='ptFactTpId_"+checkData+"'><option value='1' >原装厂</option><option value='2'>配套厂</option><option value='3' selected>其他厂</option><option value='4'>全部</option></select></td>");
								
							}else if(d==4){
							$("table[id='"+ tableId+ "'] tr:last").append("<td><select id='ptFactTpId_"+checkData+"'><option value='1' >原装厂</option><option value='2'>配套厂</option><option value='3'>其他厂</option><option value='4' selected>全部</option></select></td>");
							
							}
							}else{
								
								d= (d == null ?"&nbsp": (d.length==0?"&nbsp":d));
								if(dtIndex==4){
									$("table[id='"+ tableId+ "'] tr:last").append("<td><input class='notEmpty_quote' type='text' value='"+d+"'></td>");
								}else if(dtIndex==3){
									$("table[id='"+ tableId+ "'] tr:last").append("<td><input class='notEmpty' type='text' value='"+d+"'></td>");
								}else{
									$("table[id='"+ tableId+ "'] tr:last").append("<td><input class='empty' type='text' value='"+d+"'></td>");
								}
							
						}
					}
					
				});
			});
			$("table[id='"+ tableId+ "'] tr:last").append("<td style='display:none'><input  name='oper' type='text' value='edit'></td>");
		});
		sort(tableId,1);
	}
	
}
function analysiseGbRstPsImageWithCheckBox(gbRst, params, tableId, ckArrayPs, hiddenFiles,
		fileFiles,indexArray ,bErrorBox, bSuccessBox , mainId) {
	var rst = JSON.parse(gbRst);
	var msg = null;
	var checkDataArray = new Array();
	var cdaCount = 0;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		return;
	}
	var phArray = new Array();

	// checkbox包含多个参数

	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {

				ckArray[ckCount++] = hIndex;
			}
		});
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	// 图片区域用来存放隐藏域的索引
	var ffCount = 0;
	var fileFilesArr = new Array(fileFiles.length);
	$(fileFiles).each(function(index, ffData) {
		$.each(rst.result.head, function(ffIndex, fffData) {
			if (fffData == ffData) {
				fileFilesArr[ffCount++] = ffIndex;
			}
		});
	});
	
	var indexCount = 0;
	var indexFilesArr = new Array(indexArray.length);
	$(indexArray).each(function(index, ffData) {
		$.each(rst.result.head, function(ffIndex, fffData) {
			if (fffData == ffData) {
				indexFilesArr[indexCount++] = ffIndex;
			}
		});
	});

	// hiddenFilesArr用来存放隐藏域的索引
	var hfCount = 0;
	var hiddenFilesArr = new Array(hiddenFiles.length);
	$(hiddenFiles).each(function(index, hfData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == hfData) {
				hiddenFilesArr[hfCount++] = hIndex;
			}
		});
	});

	if (rst.result.data != null) {
		$
				.each(
						rst.result.data,
						function(index, dt) {
							// if (index <= rst.result.data.length) {
							$("table[id='" + tableId + "']")
									.append("<tr></tr>");
							// }
							var checkData = "";
							$(ckArray).each(function(ckIndex, ckData) {
								var m = ckArray.length - 1;
								$.each($(dt), function(ddtIndex, ddl) {
									if (ddtIndex == ckData) {
										if (ckIndex < m) {
											checkData += ddl + ",";
										} else {
											checkData += ddl;
											return false;
										}

									}
								});
							});
							checkDataArray[cdaCount++] = checkData;
							$("table[id='" + tableId + "'] tr:last").append(
									"<td><input type='checkBox' disabled='disabled' value='" + checkData
											+ "' onclick='javascript:del(this.value,"
											+ tableId + ")'/></td>");
							$(phArray)
									.each(
											function(phIndex, data) {
												$
														.each(
																$(dt),
																function(
																		dtIndex,
																		d) {
																	if (dtIndex == data) {

																		if (isHiddenFile(
																				fileFilesArr,
																				data)) {
																			if (d === null || d=== undefined || d==='') {
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																						.append(
																								"<td width='103'>无图片</td>");
																			} else {
																				
																				$(
																						"table[id='"
																								+ tableId
																								+ "'] tr:last")
																						.append(
																								"<td width='103'><a  href='"
																										+ d
																										+ "' target='blank'>查看</a></td>");

																				;

																			}

																		} else if (isHiddenFile(
																				hiddenFilesArr,
																				data)) {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td style='display:none'>"
																									+ (d === null ? "未填写"
																											: d)
																									+ "</td>");
																	
																			

																		}else if (isHiddenFile(
																				indexFilesArr,
																				data)) {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td width='60'>"
																									+ d 
																									+ "</td>");

																		} else {
																			$(
																					"table[id='"
																							+ tableId
																							+ "'] tr:last")
																					.append(
																							"<td><input type='text' value='"
																									+ (d === null ? "未填写"
																											: d)
																									+ "'></td>");
																		}
																	}
																});
											});
						});

	}
}
function unfinished()
{
	alert("功能尚未完善!");
}

function analysiseGbRstWithEditAndHFFPsAndPage(gbRst, params, tableId, ckArrayPs,
		hiddenFiles, fileFiles, timeFiles, recommendFiles, emStatusFile,pageIndex,pageSize,
		bErrorBox, bSuccessBox)
{
	// var rfArray = new Array();
	// var rfCount = 0;
	var timeArray = new Array();
	var tAfCount = 0;
	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		$("table[id='" + tableId + "']").append("<tr><td colspan='20'>暂无相关数据</td></tr>");
		return;
	}
	var phArray = new Array();

	// checkbox包含多个参数

	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {
				ckArray[ckCount++] = hIndex;
			}
		});
	});
	// hiddenFilesArr用来存放隐藏域的索引
	var hfCount = 0;
	var hiddenFilesArr = new Array(hiddenFiles.length);
	$(hiddenFiles).each(function(index, hfData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == hfData) {
				hiddenFilesArr[hfCount++] = hIndex;
			}
		});
	});
	// 图片区域索引
	var ffCount = 0;
	var fileFilesArr = new Array(fileFiles.length);
	$(fileFiles).each(function(index, ffData) {
		$.each(rst.result.head, function(ffIndex, fffData) {
			if (fffData == ffData) {
				fileFilesArr[ffCount++] = ffIndex;
			}
		});
	});
	// 时间区域索引
	var timeCount = 0;
	var timeFilesArr = new Array(timeFiles.length);
	$(timeFiles).each(function(index, timeData) {
		$.each(rst.result.head, function(tfIndex, tfData) {
			if (tfData == timeData) {
				timeFilesArr[timeCount++] = tfIndex;
			}
		});
	});

	// 推荐域转化用来存放隐藏域的索引
	var rfCount = 0;
	var rfFilesArr = new Array(recommendFiles.length);
	$(recommendFiles).each(function(index, rfsData) {
		$.each(rst.result.head, function(rfIndex, rfData) {
			if (rfData == rfsData) {
				rfFilesArr[rfCount++] = rfIndex;
			}
		});
	});

	var emStausCount = 0;
	var emStatusFileArr = new Array(emStatusFile.length);
	$(emStatusFile).each(function(index, emsData) {
		$.each(rst.result.head, function(rfIndex, rfData) {
			if (rfData == emsData) {
				emStatusFileArr[emStausCount++] = rfIndex;
			}
		});
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	
	var detailCount =0;
	
	if (rst.result.data != null) {
		$.each(rst.result.data,function(index, dt) {
			var imagesArray = new Array();
			imageCount = 0;
			var checkData = "";
			$("table[id='" + tableId + "']").append("<tr></tr>");
			$("table[id='"+ tableId+ "'] tr:last").append("<td width='40'>"+((++detailCount)+pageIndex*pageSize)+"</td>");
			$(ckArray).each(function(ckIndex, ckData) {
				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});
			$(phArray).each(function(phIndex, data) {
				$.each($(dt),function(dtIndex,d) {
					if (dtIndex == data) {
						if (isHiddenFile(hiddenFilesArr,data)) {
							$("table[id='"+ tableId+ "'] tr:last").append("<td style='display:none'>"
													+ (d === null ? "未填写": d)+ "</td>");
						} else if (isHiddenFile(fileFilesArr,data)) {
							if (d == null || d=="" || d==undefined || d=='') {
								$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>无图片</td>");
								imagesArray[imageCount++] = 0;
							} else {
								/*
								 * $(
								 * "table[id='" +
								 * tableId +
								 * "']
								 * tr:last")
								 * .append( "<td width='103'><a
								 * class='fancybox'
								 * href='"+d+"'>查看</a></td>");
								 */
								$("table[id='"+ tableId+ "'] tr:last").append(
												"<td width='103'><a  href='"+ d+ "' target='blank'>查看</a></td>");
								imagesArray[imageCount++] = d;
							}

						} else if (isHiddenFile(timeFilesArr,data)) {
							if (d != null || d!=''|| d!= undefined || d != "null") {
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103' ><div id='quoteRestTime_"
													+ tAfCount+ "'"+ d+ "</div></td>");
							timeArray[tAfCount++] = d;
						}
					} else if (isHiddenFile(emStatusFileArr,data)) {
						d = (d == 'null' ? -1: (d == null ? -1: d));
						switch (d) {
						case -1:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>未填写</td>");
							break;
						case 0:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>保存</td>");
							break;
						case 1:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>发布</td>");
							break;
						case 2:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>匹配中</td>");
							break;
						case 3:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>匹配成功</td>");
							break;
						case 4:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>匹配失败</td>");
							break;
						case 5:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>取消</td>");
							break;
						case 6:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>报价中</td>");
							break;
						case 7:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>询价结束</td>");
							break;
						case 8:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>确定报价</td>");
							break;
						case 9:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>转订单</td>");
							break;
						case 10:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>失效</td>");
							break;
						}

					} else if (isHiddenFile(rfFilesArr,data)) {
						/*
						 * if
						 * (d
						 * ===
						 * null) { $(
						 * "table[id='" +
						 * tableId +
						 * "']
						 * tr:last")
						 * .append( "<td></td>"); }
						 * else { $(
						 * "table[id='" +
						 * tableId +
						 * "']
						 * tr:last")
						 * .append( "<td><img
						 * src='" +
						 * d +
						 * "'/></td>"); }
						 */
						switch (d) {
						case 1:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>客户指定</td>");
							break;
						case 2:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>平台匹配</td>");
							break;
						default:$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>未知</td>");
						break;
						}
					} else {
						if (d === null || d==="" || d===undefined || d==='' ){
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>&nbsp;</td>");
						}else{
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>"+d+ "</td>");
						}
					}
				}

			});

			});

			$("table[id='" + tableId + "'] tr:last").append(
					"<td width='103'><a href='javascript:void(0);', onclick='checkQuoteDetail(\""+ checkData + "\",\"" + imagesArray+"\",3);'>报价</a></td>");
			// alert( typeof imagesArray[1]);
		});
	}

	$("#timeArray").val(timeArray);
	getRestTime1();
}

//---------------------------------------------------
function analysiseGbRstWithEditAndHFFPsAndPage2(gbRst, params, tableId, ckArrayPs,
		hiddenFiles, fileFiles, timeFiles, recommendFiles, emStatusFile,pageIndex,pageSize,
		bErrorBox, bSuccessBox)
{
	// var rfArray = new Array();
	// var rfCount = 0;
	var timeArray = new Array();
	var tAfCount = 0;
	var rst = JSON.parse(gbRst);
	var msg = null;
	if (rst.msg != null) {
		msg = rst.msg;
	}
	if (rst.state == 1) {
		if (bErrorBox) {
			alert(msg);
		}
		return;
	}
	if (rst.result == null || rst.result.len <= 0) {
		$("table[id='" + tableId + "']").append("<tr><td colspan='20'>暂无相关数据</td></tr>");
		return;
	}
	var phArray = new Array();

	// checkbox包含多个参数

	var ckArray = new Array();// 用来存储checkbox中多个参数的索引

	var ckCount = 0;
	$(ckArrayPs).each(function(index, ckData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == ckData) {
				ckArray[ckCount++] = hIndex;
			}
		});
	});
	// hiddenFilesArr用来存放隐藏域的索引
	var hfCount = 0;
	var hiddenFilesArr = new Array(hiddenFiles.length);
	$(hiddenFiles).each(function(index, hfData) {
		$.each(rst.result.head, function(hIndex, hData) {
			if (hData == hfData) {
				hiddenFilesArr[hfCount++] = hIndex;
			}
		});
	});
	// 图片区域索引
	var ffCount = 0;
	var fileFilesArr = new Array(fileFiles.length);
	$(fileFiles).each(function(index, ffData) {
		$.each(rst.result.head, function(ffIndex, fffData) {
			if (fffData == ffData) {
				fileFilesArr[ffCount++] = ffIndex;
			}
		});
	});
	// 时间区域索引
	var timeCount = 0;
	var timeFilesArr = new Array(timeFiles.length);
	$(timeFiles).each(function(index, timeData) {
		$.each(rst.result.head, function(tfIndex, tfData) {
			if (tfData == timeData) {
				timeFilesArr[timeCount++] = tfIndex;
			}
		});
	});

	// 推荐域转化用来存放隐藏域的索引
	var rfCount = 0;
	var rfFilesArr = new Array(recommendFiles.length);
	$(recommendFiles).each(function(index, rfsData) {
		$.each(rst.result.head, function(rfIndex, rfData) {
			if (rfData == rfsData) {
				rfFilesArr[rfCount++] = rfIndex;
			}
		});
	});

	var emStausCount = 0;
	var emStatusFileArr = new Array(emStatusFile.length);
	$(emStatusFile).each(function(index, emsData) {
		$.each(rst.result.head, function(rfIndex, rfData) {
			if (rfData == emsData) {
				emStatusFileArr[emStausCount++] = rfIndex;
			}
		});
	});
	// 所要列出的参数列表
	// 查出参数在head中的索引位置
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(rst.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	
	var detailCount =0;
	
	if (rst.result.data != null) {
		$.each(rst.result.data,function(index, dt) {
			var imagesArray = new Array();
			imageCount = 0;
			var checkData = "";
			$("table[id='" + tableId + "']").append("<tr></tr>");
			$("table[id='"+ tableId+ "'] tr:last").append("<td width='40'>"+((++detailCount)+pageIndex*pageSize)+"</td>");
			$(ckArray).each(function(ckIndex, ckData) {
				var m = ckArray.length - 1;
				$.each($(dt), function(ddtIndex, ddl) {
					if (ddtIndex == ckData) {
						if (ckIndex < m) {
							checkData += ddl + ",";
						} else {
							checkData += ddl;
							return false;
						}
					}
				});
			});
			$(phArray).each(function(phIndex, data) {
				$.each($(dt),function(dtIndex,d) {
					if (dtIndex == data) {
						if (isHiddenFile(hiddenFilesArr,data)) {
							$("table[id='"+ tableId+ "'] tr:last").append("<td style='display:none'>"
													+ (d === null ? "未填写": d)+ "</td>");
						} else if (isHiddenFile(fileFilesArr,data)) {
							if (d == null || d=="" || d==undefined || d=='') {
								$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>无图片</td>");
								imagesArray[imageCount++] = 0;
							} else {
								/*
								 * $(
								 * "table[id='" +
								 * tableId +
								 * "']
								 * tr:last")
								 * .append( "<td width='103'><a
								 * class='fancybox'
								 * href='"+d+"'>查看</a></td>");
								 */
								$("table[id='"+ tableId+ "'] tr:last").append(
												"<td width='103'><a  href='"+ d+ "' target='blank'>查看</a></td>");
								imagesArray[imageCount++] = d;
							}

						} else if (isHiddenFile(timeFilesArr,data)) {
							if (d != null || d!=''|| d!= undefined || d != "null") {
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103' ><div id='quoteRestTime2_"
													+ tAfCount+ "'>"+ d+ "</div></td>");
							timeArray[tAfCount++] = d;
						}
					} else if (isHiddenFile(emStatusFileArr,data)) {
						d = (d == 'null' ? -1: (d == null ? -1: d));
						switch (d) {
						case -1:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>未填写</td>");
							break;
						case 0:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>保存</td>");
							break;
						case 1:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>发布</td>");
							break;
						case 2:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>匹配中</td>");
							break;
						case 3:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>匹配成功</td>");
							break;
						case 4:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>匹配失败</td>");
							break;
						case 5:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>取消</td>");
							break;
						case 6:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>报价中</td>");
							break;
						case 7:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>询价结束</td>");
							break;
						case 8:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>确定报价</td>");
							break;
						case 9:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>转订单</td>");
							break;
						case 10:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>失效</td>");
							break;
						}

					} else if (isHiddenFile(rfFilesArr,data)) {
						/*
						 * if
						 * (d
						 * ===
						 * null) { $(
						 * "table[id='" +
						 * tableId +
						 * "']
						 * tr:last")
						 * .append( "<td></td>"); }
						 * else { $(
						 * "table[id='" +
						 * tableId +
						 * "']
						 * tr:last")
						 * .append( "<td><img
						 * src='" +
						 * d +
						 * "'/></td>"); }
						 */
						switch (d) {
						case 1:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>客户指定</td>");
							break;
						case 2:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>平台匹配</td>");
							break;
						case 3:
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>主动查找</td>");
							break;
						default:$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>未知</td>");
						
						break;
						}
					} else {
						if (d === null || d==="" || d===undefined || d==='' ){
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>&nbsp;</td>");
						}else{
							$("table[id='"+ tableId+ "'] tr:last").append("<td width='103'>"+d+ "</td>");
						}
					}
				}

			});

			});

			$("table[id='" + tableId + "'] tr:last").append(
					"<td width='103'><a href='javascript:void(0);', onclick='checkQuoteDetail(\""+ checkData + "\",\"" + imagesArray+"\",1);'>报价</a></td>");
			
			// alert( typeof imagesArray[1]);
		});
	}

	$("#timeArray2").val(timeArray);
	getRestTime2();
}

function getRestTime2() {
	var expiredTimess = $("#timeArray2").val();
	var expiredTimes = expiredTimess.split(",");
	$(expiredTimes).each(
			function(index, data) {
				
				
				var expiredTime = data;
				var regEx = new RegExp("\\-", "gi");
				if (expiredTime != undefined) {
					var et = expiredTime.replace(regEx, "/");
					var EndTime = Date.parse(et);
					var NowTime = new Date();
					//
					var nMS =  EndTime - NowTime.getTime() ;
					if (nMS > 0) {
						var nD = Math.floor(nMS / (1000 * 60 * 60 * 24));
						var nH = Math.floor(nMS / (1000 * 60 * 60)) % 24;
						var nM = Math.floor(nMS / (1000 * 60)) % 60;
						var nS = Math.floor(nMS / 1000) % 60;
						/*
						 * $("div[id='quoteRestTime']").html( nD + '天' + nH +
						 * '时' + nM + '分' + nS + '秒');
						 */
						$("#quoteRestTime2_" + index).html(
								//(nD <= 9 ? ("0" + nD) : nD) + '天'+
										 (nH <= 9 ? ("0" + nH) : nH) + ':'
										+ (nM <= 9 ? ("0" + nM) : nM) + ':'
										+ (nS <= 9 ? ("0" + nS) : nS));
					} else {
						$("#quoteRestTime2_" + index).html("已过期");
					}

					/*
					 * $("#quoteRestTime_"+index).html( nD + '天' + nH + '时' + nM +
					 * '分' + nS + '秒'); }else{ $("#quoteRestTime_"+index).html(
					 * "已过期"); }
					 */
				}
			});
	setTimeout(arguments.callee, 1000);
}




